<template>
  <div>测试页面:{{ count }}</div>
  <div>
    <button class="bg-red-200" @click="onBack">返回</button>
  </div>
  <div>
    <!-- assets/svg/electron.svg -->
    <icon-custom-electron />
  </div>
  <div><el-button type="primary" @click="onAdd">新增</el-button></div>
  <br />
  <div><el-button type="primary" @click="onGetAll">获取所有1</el-button></div>
  <div>内容</div>
  {{ allData }}
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useTestStore } from '@stores/TestStore'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'

const testStore = useTestStore()
const { count } = storeToRefs(testStore)
const $router = useRouter()
const allData = ref<any>(null)
function onBack() {
  $router.back()
}

async function onAdd() {
  console.log(await window.api.createDocument('测试'))
}
async function onGetAll() {
  console.log('onGetAll', window.api)
  allData.value = await window.api?.getDocuments()
  console.log(allData)
}
</script>

<style scoped></style>
